/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50624
Source Host           : localhost:3306
Source Database       : cloud_user

Target Server Type    : MYSQL
Target Server Version : 50624
File Encoding         : 65001

Date: 2018-06-17 09:47:24
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for app_user
-- ----------------------------
DROP TABLE IF EXISTS `app_user`;
CREATE TABLE `app_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `username` varchar(50) NOT NULL COMMENT '用户名',
  `password` varchar(60) NOT NULL COMMENT '密码',
  `nickname` varchar(255) DEFAULT NULL COMMENT '昵称',
  `headImgUrl` varchar(1024) DEFAULT NULL COMMENT '头像url',
  `phone` varchar(11) DEFAULT NULL COMMENT '手机号',
  `sex` tinyint(1) DEFAULT NULL COMMENT '性别',
  `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态（1有效,0无效）',
  `type` varchar(16) NOT NULL COMMENT '类型（暂未用）',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  `updateTime` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

-- ----------------------------
-- Records of app_user
-- ----------------------------
INSERT INTO `app_user` VALUES ('1', 'admin', '$2a$10$3uOoX1ps14CxuotogUoDreW8zXJOZB9XeGdrC/xDV36hhaE8Rn9HO', '测试1', '', '', '1', '1', 'APP', '2018-01-17 16:57:01', '2018-01-17 16:57:01');
INSERT INTO `app_user` VALUES ('2', 'superadmin', '$2a$10$.gLkG0j2kM0stWoOvPBvqu0H9uSD0HUlpErI.PTKyZQkSUZIV2wFq', '超级管理员', null, null, '1', '1', 'BACKEND', '2018-01-19 20:30:11', '2018-01-19 20:30:11');

-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `permission` varchar(32) NOT NULL COMMENT '权限标识',
  `name` varchar(50) NOT NULL COMMENT '名称',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  `updateTime` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `permission` (`permission`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COMMENT='权限标识表';

-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT INTO `sys_permission` VALUES ('1', 'back:permission:save', '保存权限标识', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('2', 'back:permission:update', '修改权限标识', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('3', 'back:permission:delete', '删除权限标识', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('4', 'back:permission:query', '查询权限标识', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('5', 'back:role:save', '添加角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('6', 'back:role:update', '修改角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('7', 'back:role:delete', '删除角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('8', 'back:role:permission:set', '给角色分配权限', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('9', 'back:user:query', '用户查询', '2018-01-18 17:12:00', '2018-01-18 17:12:05');
INSERT INTO `sys_permission` VALUES ('10', 'back:user:update', '修改用户', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('11', 'back:user:role:set', '给用户分配角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('12', 'back:user:password', '用户重置密码', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('13', 'back:menu:save', '添加菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('14', 'back:menu:update', '修改菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('15', 'back:menu:delete', '删除菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('16', 'back:menu:query', '查询菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('17', 'back:menu:set2role', '给角色分配菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('18', 'back:role:query', '查询角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('19', 'user:role:byuid', '获取用户的角色', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('20', 'role:permission:byroleid', '获取角色的权限', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('21', 'menu:byroleid', '获取角色的菜单', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('22', 'ip:black:query', '查询黑名单ip', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('23', 'ip:black:save', '添加黑名单ip', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('24', 'ip:black:delete', '删除黑名单ip', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('25', 'log:query', '日志查询', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('26', 'file:query', '文件查询', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('27', 'file:del', '文件删除', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('28', 'mail:save', '保存邮件', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('29', 'mail:update', '修改邮件', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('30', 'mail:query', '邮件查询', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('31', 'sms:query', '短信发送记录查询', '2018-01-18 17:06:39', '2018-01-18 17:06:42');
INSERT INTO `sys_permission` VALUES ('32', 'client:save', '保存client', '2018-06-28 17:06:39', '2018-06-28 17:06:39');
INSERT INTO `sys_permission` VALUES ('33', 'client:update', '修改client', '2018-06-28 17:06:39', '2018-06-28 17:06:39');
INSERT INTO `sys_permission` VALUES ('34', 'client:query', '查询client', '2018-06-28 17:06:39', '2018-06-28 17:06:39');
INSERT INTO `sys_permission` VALUES ('35', 'client:del', '删除client', '2018-06-28 17:06:39', '2018-06-28 17:06:39');

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `code` varchar(32) NOT NULL COMMENT '角色code',
  `name` varchar(50) NOT NULL COMMENT '角色名',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  `updateTime` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='角色表';

-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES ('1', 'SUPER_ADMIN', '超级管理员', '2018-01-19 20:32:16', '2018-01-19 20:32:18');

-- ----------------------------
-- Table structure for sys_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_permission`;
CREATE TABLE `sys_role_permission` (
  `roleId` int(11) NOT NULL COMMENT '角色id',
  `permissionId` int(11) NOT NULL COMMENT '权限id',
  PRIMARY KEY (`roleId`,`permissionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色权限关系表';

-- ----------------------------
-- Records of sys_role_permission
-- ----------------------------
INSERT INTO `sys_role_permission` VALUES ('1', '1');
INSERT INTO `sys_role_permission` VALUES ('1', '2');
INSERT INTO `sys_role_permission` VALUES ('1', '3');
INSERT INTO `sys_role_permission` VALUES ('1', '4');
INSERT INTO `sys_role_permission` VALUES ('1', '5');
INSERT INTO `sys_role_permission` VALUES ('1', '6');
INSERT INTO `sys_role_permission` VALUES ('1', '7');
INSERT INTO `sys_role_permission` VALUES ('1', '8');
INSERT INTO `sys_role_permission` VALUES ('1', '9');
INSERT INTO `sys_role_permission` VALUES ('1', '10');
INSERT INTO `sys_role_permission` VALUES ('1', '11');
INSERT INTO `sys_role_permission` VALUES ('1', '12');
INSERT INTO `sys_role_permission` VALUES ('1', '13');
INSERT INTO `sys_role_permission` VALUES ('1', '14');
INSERT INTO `sys_role_permission` VALUES ('1', '15');
INSERT INTO `sys_role_permission` VALUES ('1', '16');
INSERT INTO `sys_role_permission` VALUES ('1', '17');
INSERT INTO `sys_role_permission` VALUES ('1', '18');
INSERT INTO `sys_role_permission` VALUES ('1', '19');
INSERT INTO `sys_role_permission` VALUES ('1', '20');
INSERT INTO `sys_role_permission` VALUES ('1', '21');
INSERT INTO `sys_role_permission` VALUES ('1', '22');
INSERT INTO `sys_role_permission` VALUES ('1', '23');
INSERT INTO `sys_role_permission` VALUES ('1', '24');
INSERT INTO `sys_role_permission` VALUES ('1', '25');
INSERT INTO `sys_role_permission` VALUES ('1', '26');
INSERT INTO `sys_role_permission` VALUES ('1', '27');
INSERT INTO `sys_role_permission` VALUES ('1', '28');
INSERT INTO `sys_role_permission` VALUES ('1', '29');
INSERT INTO `sys_role_permission` VALUES ('1', '30');
INSERT INTO `sys_role_permission` VALUES ('1', '31');
INSERT INTO `sys_role_permission` VALUES ('1', '32');
INSERT INTO `sys_role_permission` VALUES ('1', '33');
INSERT INTO `sys_role_permission` VALUES ('1', '34');
INSERT INTO `sys_role_permission` VALUES ('1', '35');

-- ----------------------------
-- Table structure for sys_role_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_user`;
CREATE TABLE `sys_role_user` (
  `userId` int(11) NOT NULL COMMENT '用户id',
  `roleId` int(11) NOT NULL COMMENT '角色id',
  PRIMARY KEY (`userId`,`roleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色用户关系表';

-- ----------------------------
-- Records of sys_role_user
-- ----------------------------
INSERT INTO `sys_role_user` VALUES ('1', '1');
INSERT INTO `sys_role_user` VALUES ('2', '1');

-- ----------------------------
-- Table structure for t_wechat
-- ----------------------------
DROP TABLE IF EXISTS `t_wechat`;
CREATE TABLE `t_wechat` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `openid` varchar(128) NOT NULL COMMENT '微信openid',
  `unionid` varchar(128) DEFAULT NULL COMMENT '微信unionid',
  `userId` int(11) DEFAULT NULL COMMENT '绑定用户的id',
  `app` varchar(32) NOT NULL COMMENT '公众号标识',
  `nickname` varchar(64) NOT NULL COMMENT '微信昵称',
  `sex` varchar(16) DEFAULT NULL COMMENT '微信返回的性别',
  `province` varchar(64) DEFAULT NULL COMMENT '微信返回的省',
  `city` varchar(64) DEFAULT NULL COMMENT '微信返回的城市',
  `country` varchar(64) DEFAULT NULL COMMENT '微信返回的国家',
  `headimgurl` varchar(1024) DEFAULT NULL COMMENT '微信头像',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  `updateTime` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `openid` (`openid`),
  KEY `userId` (`userId`),
  KEY `unionid` (`unionid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信信息表';

-- ----------------------------
-- Records of t_wechat
-- ----------------------------

-- ----------------------------
-- Table structure for user_credentials
-- ----------------------------
DROP TABLE IF EXISTS `user_credentials`;
CREATE TABLE `user_credentials` (
  `username` varchar(50) NOT NULL COMMENT '用户名或手机号等',
  `type` varchar(16) NOT NULL COMMENT '账号类型（用户名、手机号）',
  `userId` int(11) NOT NULL COMMENT '用户id',
  PRIMARY KEY (`username`),
  KEY `userId` (`userId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户凭证表';

-- ----------------------------
-- Records of user_credentials
-- ----------------------------
INSERT INTO `user_credentials` VALUES ('admin', 'USERNAME', '1');
INSERT INTO `user_credentials` VALUES ('superadmin', 'USERNAME', '2');














oracle





SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE app_user (
  id number(11) NOT NULL PRIMARY KEY,
  username varchar(50) NOT NULL,
  password varchar(60) NOT NULL,
  nickname varchar(255) DEFAULT NULL,
  headImgUrl varchar(1024) DEFAULT NULL,
  phone varchar(11) DEFAULT NULL ,
  sex number(1) DEFAULT NULL,
  enabled number(1) DEFAULT '1' ,
  type varchar(16) NOT NULL,
  createTime date NOT NULL,
  updateTime date NOT NULL
)

comment on table app_user is '用户表';
comment on column app_user.id is '自增id';
comment on column app_user.username is '用户名';
comment on column app_user.password is '密码';
comment on column app_user.nickname is '昵称';
comment on column app_user.headImgUrl is '头像url';
comment on column app_user.phone is '手机号';
comment on column app_user.sex is '性别';
comment on column app_user.enabled is '状态（1有效,0无效）';
comment on column app_user.type is '类型（暂未用）';
comment on column app_user.createTime is '创建时间';
comment on column app_user.updateTime is '更新时间';

CREATE SEQUENCE app_user_seq INCREMENT BY 1 START WITH 3 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER app_user_TRG
  BEFORE INSERT ON app_user
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT app_user_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;
-- ----------------------------
-- Records of app_user
-- ----------------------------
INSERT INTO app_user VALUES (1, 'admin', '$2a$10$3uOoX1ps14CxuotogUoDreW8zXJOZB9XeGdrC/xDV36hhaE8Rn9HO', '测试1', '', '', 1, 1, 'APP', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO app_user VALUES (2, 'superadmin', '$2a$10$.gLkG0j2kM0stWoOvPBvqu0H9uSD0HUlpErI.PTKyZQkSUZIV2wFq', '超级管理员', null, null, 1, 1, 'BACKEND', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));

-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------

CREATE TABLE sys_permission (
  id number(11) NOT NULL PRIMARY KEY,
  permission varchar(32) NOT NULL,
  name varchar(50) NOT NULL,
  createTime date NOT NULL,
  updateTime date NOT NULL
)

comment on table sys_permission is '权限标识表';
comment on column sys_permission.id is '自增id';
comment on column sys_permission.permission is '权限标识';
comment on column sys_permission.name is '名称';
comment on column sys_permission.createTime is '创建时间';
comment on column sys_permission.updateTime is '修改时间';


CREATE SEQUENCE sys_permission_seq INCREMENT BY 1 START WITH 32 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER sys_permission_TRG
  BEFORE INSERT ON sys_permission
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT sys_permission_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;

-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT INTO sys_permission VALUES (1, 'back:permission:save', '保存权限标识', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (2, 'back:permission:update', '修改权限标识', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (3, 'back:permission:delete', '删除权限标识', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (4, 'back:permission:query', '查询权限标识', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (5, 'back:role:save', '添加角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (6, 'back:role:update', '修改角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (7, 'back:role:delete', '删除角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (8, 'back:role:permission:set', '给角色分配权限', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (9, 'back:user:query', '用户查询', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (10, 'back:user:update', '修改用户', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (11, 'back:user:role:set', '给用户分配角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (12, 'back:user:password', '用户重置密码', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (13, 'back:menu:save', '添加菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (14, 'back:menu:update', '修改菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (15, 'back:menu:delete', '删除菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (16, 'back:menu:query', '查询菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (17, 'back:menu:set2role', '给角色分配菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (18, 'back:role:query', '查询角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (19, 'user:role:byuid', '获取用户的角色', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (20, 'role:permission:byroleid', '获取角色的权限', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (21, 'menu:byroleid', '获取角色的菜单', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (22, 'ip:black:query', '查询黑名单ip', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (23, 'ip:black:save', '添加黑名单ip', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (24, 'ip:black:delete', '删除黑名单ip', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (25, 'log:query', '日志查询', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (26, 'file:query', '文件查询', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (27, 'file:del', '文件删除', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (28, 'mail:save', '保存邮件', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (29, 'mail:update', '修改邮件', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (30, 'mail:query', '邮件查询', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (31, 'sms:query', '短信发送记录查询', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (32, 'client:save', '保存client', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (33, 'client:update', '修改client', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (34, 'client:query', '查询client', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));
INSERT INTO sys_permission VALUES (35, 'client:del', '删除client', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS sys_role;
CREATE TABLE sys_role (
  id number(11) NOT NULL PRIMARY KEY,
  code varchar(32) NOT NULL,
  name varchar(50) NOT NULL,
  createTime date NOT NULL,
  updateTime date NOT NULL
)



comment on table sys_role is '角色表';
comment on column sys_role.id is '自增id';
comment on column sys_role.code is '角色code';
comment on column sys_role.name is '角色名';
comment on column sys_role.createTime is '创建时间';
comment on column sys_role.updateTime is '修改时间';


CREATE SEQUENCE sys_role_seq INCREMENT BY 1 START WITH 2 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER sys_role_TRG
  BEFORE INSERT ON sys_role
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT sys_role_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO sys_role VALUES (1, 'SUPER_ADMIN', '超级管理员', to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ), to_date ( '2015-04-03 16:51:38' , 'YYYY-MM-DD HH24:MI:SS' ));

-- ----------------------------
-- Table structure for sys_role_permission
-- ----------------------------
DROP TABLE IF EXISTS sys_role_permission;
CREATE TABLE sys_role_permission (
  roleId number(11) NOT NULL,
  permissionId number(11) NOT NULL
)

comment on table sys_role_permission is '角色权限关系表';
comment on column sys_role_permission.roleId is '角色id';
comment on column sys_role_permission.permissionId is '权限id';

-- ----------------------------
-- Records of sys_role_permission
-- ----------------------------
INSERT INTO sys_role_permission VALUES (1, 1);
INSERT INTO sys_role_permission VALUES (1, 2);
INSERT INTO sys_role_permission VALUES (1, 3);
INSERT INTO sys_role_permission VALUES (1, 4);
INSERT INTO sys_role_permission VALUES (1, 5);
INSERT INTO sys_role_permission VALUES (1, 6);
INSERT INTO sys_role_permission VALUES (1, 7);
INSERT INTO sys_role_permission VALUES (1, 8);
INSERT INTO sys_role_permission VALUES (1, 9);
INSERT INTO sys_role_permission VALUES (1, 10);
INSERT INTO sys_role_permission VALUES (1, 11);
INSERT INTO sys_role_permission VALUES (1, 12);
INSERT INTO sys_role_permission VALUES (1, 13);
INSERT INTO sys_role_permission VALUES (1, 14);
INSERT INTO sys_role_permission VALUES (1, 15);
INSERT INTO sys_role_permission VALUES (1, 16);
INSERT INTO sys_role_permission VALUES (1, 17);
INSERT INTO sys_role_permission VALUES (1, 18);
INSERT INTO sys_role_permission VALUES (1, 19);
INSERT INTO sys_role_permission VALUES (1, 20);
INSERT INTO sys_role_permission VALUES (1, 21);
INSERT INTO sys_role_permission VALUES (1, 22);
INSERT INTO sys_role_permission VALUES (1, 23);
INSERT INTO sys_role_permission VALUES (1, 24);
INSERT INTO sys_role_permission VALUES (1, 25);
INSERT INTO sys_role_permission VALUES (1, 26);
INSERT INTO sys_role_permission VALUES (1, 27);
INSERT INTO sys_role_permission VALUES (1, 28);
INSERT INTO sys_role_permission VALUES (1, 29);
INSERT INTO sys_role_permission VALUES (1, 30);
INSERT INTO sys_role_permission VALUES (1, 31);
INSERT INTO sys_role_permission VALUES (1, 32);
INSERT INTO sys_role_permission VALUES (1, 33);
INSERT INTO sys_role_permission VALUES (1, 34);
INSERT INTO sys_role_permission VALUES (1, 35);

-- ----------------------------
-- Table structure for sys_role_user
-- ----------------------------
DROP TABLE IF EXISTS sys_role_user;
CREATE TABLE sys_role_user (
  userId number(11) NOT NULL,
  roleId number(11) NOT NULL
)
comment on table sys_role_user is '角色用户关系表';
comment on column sys_role_user.userId is '用户id';
comment on column sys_role_user.roleId is '角色id';
-- ----------------------------
-- Records of sys_role_user
-- ----------------------------
INSERT INTO sys_role_user VALUES (1, 1);
INSERT INTO sys_role_user VALUES (2, 1);

-- ----------------------------
-- Table structure for t_wechat
-- ----------------------------
DROP TABLE IF EXISTS t_wechat;
CREATE TABLE t_wechat (
  id number(11) NOT NULL PRIMARY KEY ,
  openid varchar(128) NOT NULL,
  unionid varchar(128) DEFAULT NULL,
  userId number(11) DEFAULT NULL,
  app varchar(32) NOT NULL,
  nickname varchar(64) NOT NULL,
  sex varchar(16) DEFAULT NULL,
  province varchar(64) DEFAULT NULL,
  city varchar(64) DEFAULT NULL,
  country varchar(64) DEFAULT NULL,
  headimgurl varchar(1024) DEFAULT NULL,
  createTime date NOT NULL,
  updateTime date NOT NULL
)

comment on table t_wechat is '微信信息表';
comment on column t_wechat.id is '自增id';
comment on column t_wechat.openid is '微信openid';
comment on column t_wechat.unionid is '微信unionid';
comment on column t_wechat.userId is '绑定用户的id';
comment on column t_wechat.app is '公众号标识';
comment on column t_wechat.nickname is '微信昵称';
comment on column t_wechat.sex is '微信返回的性别';
comment on column t_wechat.province is '微信返回的省';
comment on column t_wechat.city is '微信返回的城市';
comment on column t_wechat.country is '微信返回的国家';
comment on column t_wechat.headimgurl is '微信头像';
comment on column t_wechat.createTime is '创建时间';
comment on column t_wechat.updateTime is '修改时间';

CREATE SEQUENCE t_wechat_seq INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER t_wechat_TRG
  BEFORE INSERT ON t_wechat
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT t_wechat_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;
-- ----------------------------
-- Records of t_wechat
-- ----------------------------

-- ----------------------------
-- Table structure for user_credentials
-- ----------------------------
DROP TABLE IF EXISTS user_credentials;
CREATE TABLE user_credentials (
  username varchar(50) NOT NULL PRIMARY KEY,
  type varchar(16) NOT NULL,
  userId number(11) NOT NULL
)
comment on table user_credentials is '用户凭证表';
comment on column user_credentials.username is '用户名或手机号等';
comment on column user_credentials.type is '账号类型（用户名、手机号）';
comment on column user_credentials.userId is '用户id';
-- ----------------------------
-- Records of user_credentials
-- ----------------------------
INSERT INTO user_credentials VALUES ('admin', 'USERNAME', 1);
INSERT INTO user_credentials VALUES ('superadmin', 'USERNAME', '2');
